<template>
<div class="">
  <!-- 事故发生的可能性(L)判定准则 -->
  <div class="border">
    <span class="content">事故发生的可能性(L)判定准则</span>
    <el-table v-loading="listLoading" :data="listL" @row-click="checkRadioOne" max-height="400px">
      <el-table-column label="选择" width="50">
        <template slot-scope="scope">
          <el-radio v-model="checkOne" :label="scope.$index">&nbsp;</el-radio>
        </template>
			</el-table-column>
      <el-table-column type="index" label="序号" align="left" width="60"/>
      <el-table-column prop="point" label="分值" align="left" width="60"/>
      <el-table-column prop="name" label="事故发生的可能性" align="left" />
    </el-table>
  </div>
  <!-- 暴露于危险环境的频繁程度(E)判定准则 -->
  <div class="border">
    <span class="content">暴露于危险环境的频繁程度(E)判定准则</span>
      <el-table v-loading="listLoading" :data="listE" @row-click="checkRadioTwo" max-height="400px">
      <el-table-column label="选择" width="50">
        <template slot-scope="scope">
          <el-radio v-model="checkTwo" :label="scope.$index">&nbsp;</el-radio>
        </template>
      </el-table-column>
      <el-table-column type="index" label="序号" align="left" width="60"/>
      <el-table-column prop="point" label="分值" align="left" width="60"/>
      <el-table-column prop="name" label="标准" align="left" />
    </el-table>
  </div>
  <!-- 发生事故事件偏差产生的后果严重性(c)判定准则 -->
  <div class="border">
    <span class="content">发生事故事件偏差产生的后果严重性(E)判定准则</span>
      <el-table v-loading="listLoading" :data="listC" @row-click="checkRadioThree" max-height="400px">
      <el-table-column label="选择" width="50">
        <template slot-scope="scope">
          <el-radio v-model="checkThree" :label="scope.$index">&nbsp;</el-radio>
        </template>
      </el-table-column>
      <el-table-column type="index" label="序号" align="left" width="60"/>
      <el-table-column prop="point" label="分值" align="left" />
      <el-table-column prop="flfg" label="法律法规及其他要求" align="left" />
      <el-table-column prop="rysw" label="人员伤亡" align="left" />
      <el-table-column prop="zjjjss" label="直接经济损失（万元）" align="left" />
      <el-table-column prop="tg" label="停工" align="left" />
      <el-table-column prop="gsxx" label="公司形象" align="left" />
      <el-table-column label="评价方法类型(LEC或LS)"  prop="type" algin="left">
        <template slot-scope="scope">{{ scope.row.type | dynamicText(typeOptions) }}</template>
      </el-table-column>
      <el-table-column label="评价方法子项(S、C)"  prop="typechildren" algin="left">
        <template slot-scope="scope">{{ scope.row.typechildren | dynamicText(typechildrenOptions) }}</template>
      </el-table-column>
    </el-table>
  </div>
    <el-button type="text" @click="determine">
      请先选择表格确定后在提交
    </el-button>
</div>
</template>

<script>

import request from '@/utils/request'

export default {
  props: ['data'],
  data() {
    return {
      checkOne: {},
      checkTwo: {},
      checkThree: {},
      numberOne:'',
      numberTwo:'',
      numberThree:'',
      row:{},
      
      listLoading:false,
      listL:[],
      listE:[],
      listC:[],
      queryL: {
        type:'LEC',
        typechildren:'L',
      },
      queryE: {
        type:'LEC',
        typechildren:'E',
      },
      queryC: {
        type:'LEC',
        typechildren:'C',
      },
      typeOptions:[{"fullName":"LEC","id":"LEC"},{"fullName":"LS","id":"LS"}],
      typechildrenOptions:[{"fullName":"S","id":"S"},{"fullName":"C","id":"C"}],
    }
  },
  created() {
    this.initDataL()
    this.initDataE()
    this.initDataC()
    },
  methods: {
    initLec(){
      this.checkOne = {}
      this.checkTwo= {}
      this.checkThree= {}
    },
    determine() {
      let sum = this.numberTwo * this.numberOne* this.numberThree
      this.$emit('point',sum,this.checkOne,this.checkTwo,)
    },
    checkRadioOne(row) {
      this.checkOne = row
      this.numberOne = Number(row.point)
    },
    checkRadioTwo(row) {
      this.checkTwo = row
      this.numberTwo = Number(row.point)
    },
    checkRadioThree(row) {
      this.checkThree = row
      this.numberThree = Number(row.point)
    },
    // L
    initDataL() {
      this.listLoading = true;
      let query = {
        ...this.queryL,
      };
      request({
        url: `/api/System/rsikStandard`,
        method: 'get',
        data: query
      }).then(res => {
        this.listL = res.data.list
        this.listLoading = false
        this.$nextTick(() => {
          this.tableHeight = "100%"
        });
      })
    },
    // E
    initDataE() {
      this.listLoading = true;
      let query = {
          ...this.queryE
      };
      request({
          url: `/api/System/rsikStandard`,
          method: 'get',
          data: query
      }).then(res => {
          this.listE = res.data.list
          this.listLoading = false
          this.$nextTick(() => {
              this.tableHeight = "100%"
          });
      })
    },
    // C
    initDataC() {
      this.listLoading = true;
      let query = {
        ...this.queryC
      };
      request({
        url: `/api/System/rsikQuence`,
        method: 'get',
        data: query
      }).then(res => {
        this.listC = res.data.list
        this.listLoading = false
        this.$nextTick(() => {
            this.tableHeight = "100%"
        });
      })
    },
  }
}
</script>

<style>
</style>